#ifndef __PlayScene_H__
#define __PlayScene_H__

#include "cocos2d.h"

USING_NS_CC;

class Board;

class PlayScene : public cocos2d::CCLayer
{
public:
	enum
	{
		LayerNum = 3,
	};

    // Here's a difference. Method 'init' in cocos2d-x returns bool, instead of returning 'id' in cocos2d-iphone
    virtual bool init();  

    // there's no 'id' in cpp, so we recommand to return the exactly class pointer
    static cocos2d::CCScene* scene();

	void onEnterTransitionDidFinish();

    // implement the "static node()" method manually
    LAYER_CREATE_FUNC(PlayScene);

	void setLayerLetters(unsigned int layerIndex, const std::string& letters);

	void checkAndRecordWord(const std::string& word);

	void update(float deltaTime);

private:
	void updateResults();

	void onUpdateResultsSucceed(CCObject* param);

	void onUpdateResultsFailed(CCObject* param);

	std::string mLayerLetters[LayerNum];

	Board* mBoard;

	float mTime;

	CCLabelTTF* mTimeLabel;
};

#endif // __PlayScene_H__
